#include <bits/stdc++.h>
using namespace std;
int main() {
  int n, i;
  cin >> n >> i;
  int k = 1  ;
  int a = 0;
  while (true) {
    bool flag = true;
    a = n * k + i;
    for (int j = 2; j <= n; j++) {
      if (a % (n - 1) != 0) {
        flag = false;
        break;
      }
      // 每一份 a/(n-1)
      a = a / (n - 1) * n + i;
    }
    if (flag)   break;
    k++;
  }
  cout << a;
  return 0;
}